package chapter04.Example18;

class Animal{
    void shout(){
        System.out.println("动物叫!");
    }
    public String toString(){
        return "这是一个动物类";
    }
}
public class Example18 {
    public static void main(String[] args) {
        Animal animal = new Animal();
        System.out.println(animal.toString());
    }
}
 +49 第四章Example20.java  0 -> 100644
package chapter04.Example20_23;

class Outer {
    int m = 0;

    void t1() {
        System.out.println("t1");
    }
    static class IS{
        int n = 1;
        void show(){
            System.out.println("我是静态内部类IS");
        }
        static void s(){
            System.out.println("静态方法s()");
        }
    }

    class Inner {
        int n = 1;

        void show1() {
            System.out.println("m=" + m);
            t1();
        }

        void show2() {
            System.out.println("show2()");
        }
    }

    void t2() {
        Inner inner = new Inner();
        System.out.println("Inner.n" + inner.n);
        inner.show2();
    }
}

public class Example20 {
    public static void main(String[] args) {
        Outer outer = new Outer();
        Outer.Inner inner = outer.new Inner();
        inner.show1();
        outer.t2();
        Outer.IS is = new Outer.IS();
        System.out.println(is.n);
        Outer.IS.s();
    }
}
 +20 第四章Example22.java  0 -> 100644
package chapter04.Example22;

class Outer {
    static int m = 0;

    static class Inner {
        int n = 1;

        void show() {
            System.out.println("外部静态变量m = " + m);
        }
    }
}

public class Example22 {
    public static void main(String[] args) {
        Outer.Inner inner = new Outer.Inner();
        inner.show();
    }
}
 +18 第四章Example23.java  0 -> 100644
package chapter04.Example23;

interface Animal{
    void shout();
}
public class Example23 {
    public static void main(String[] args) {
        String name = "小花";
        animalShout(new Animal(){
            public void shout() {
                System.out.println(name+"喵喵······");
            }
        });
    }
    public static void animalShout(Animal an){
        an.shout();
    }
}
package chapter04.Example18;

class Animal{
    void shout(){
        System.out.println("动物叫!");
    }
    public String toString(){
        return "这是一个动物类";
    }
}
public class Example18 {
    public static void main(String[] args) {
        Animal animal = new Animal();
        System.out.println(animal.toString());
    }
}
 +49 第四章Example20.java  0 -> 100644
package chapter04.Example20_23;

class Outer {
    int m = 0;

    void t1() {
        System.out.println("t1");
    }
    static class IS{
        int n = 1;
        void show(){
            System.out.println("我是静态内部类IS");
        }
        static void s(){
            System.out.println("静态方法s()");
        }
    }

    class Inner {
        int n = 1;

        void show1() {
            System.out.println("m=" + m);
            t1();
        }

        void show2() {
            System.out.println("show2()");
        }
    }

    void t2() {
        Inner inner = new Inner();
        System.out.println("Inner.n" + inner.n);
        inner.show2();
    }
}

public class Example20 {
    public static void main(String[] args) {
        Outer outer = new Outer();
        Outer.Inner inner = outer.new Inner();
        inner.show1();
        outer.t2();
        Outer.IS is = new Outer.IS();
        System.out.println(is.n);
        Outer.IS.s();
    }
}
 +20 第四章Example22.java  0 -> 100644
package chapter04.Example22;

class Outer {
    static int m = 0;

    static class Inner {
        int n = 1;

        void show() {
            System.out.println("外部静态变量m = " + m);
        }
    }
}

public class Example22 {
    public static void main(String[] args) {
        Outer.Inner inner = new Outer.Inner();
        inner.show();
    }
}
 +18 第四章Example23.java  0 -> 100644
package chapter04.Example23;

interface Animal{
    void shout();
}
public class Example23 {
    public static void main(String[] args) {
        String name = "小花";
        animalShout(new Animal(){
            public void shout() {
                System.out.println(name+"喵喵······");
            }
        });
    }
    public static void animalShout(Animal an){
        an.shout();
    }
}
package chapter04.Example18;

class Animal{
    void shout(){
        System.out.println("动物叫!");
    }
    public String toString(){
        return "这是一个动物类";
    }
}
public class Example18 {
    public static void main(String[] args) {
        Animal animal = new Animal();
        System.out.println(animal.toString());
    }
}
 +49 第四章Example20.java  0 -> 100644
package chapter04.Example20_23;

class Outer {
    int m = 0;

    void t1() {
        System.out.println("t1");
    }
    static class IS{
        int n = 1;
        void show(){
            System.out.println("我是静态内部类IS");
        }
        static void s(){
            System.out.println("静态方法s()");
        }
    }

    class Inner {
        int n = 1;

        void show1() {
            System.out.println("m=" + m);
            t1();
        }

        void show2() {
            System.out.println("show2()");
        }
    }

    void t2() {
        Inner inner = new Inner();
        System.out.println("Inner.n" + inner.n);
        inner.show2();
    }
}

public class Example20 {
    public static void main(String[] args) {
        Outer outer = new Outer();
        Outer.Inner inner = outer.new Inner();
        inner.show1();
        outer.t2();
        Outer.IS is = new Outer.IS();
        System.out.println(is.n);
        Outer.IS.s();
    }
}
 +20 第四章Example22.java  0 -> 100644
package chapter04.Example22;

class Outer {
    static int m = 0;

    static class Inner {
        int n = 1;

        void show() {
            System.out.println("外部静态变量m = " + m);
        }
    }
}

public class Example22 {
    public static void main(String[] args) {
        Outer.Inner inner = new Outer.Inner();
        inner.show();
    }
}
 +18 第四章Example23.java  0 -> 100644
package chapter04.Example23;

interface Animal{
    void shout();
}
public class Example23 {
    public static void main(String[] args) {
        String name = "小花";
        animalShout(new Animal(){
            public void shout() {
                System.out.println(name+"喵喵······");
            }
        });
    }
    public static void animalShout(Animal an){
        an.shout();
    }
}
package chapter04.Example18;

class Animal{
    void shout(){
        System.out.println("动物叫!");
    }
    public String toString(){
        return "这是一个动物类";
    }
}
public class Example18 {
    public static void main(String[] args) {
        Animal animal = new Animal();
        System.out.println(animal.toString());
    }
}
 +49 第四章Example20.java  0 -> 100644
package chapter04.Example20_23;

class Outer {
    int m = 0;

    void t1() {
        System.out.println("t1");
    }
    static class IS{
        int n = 1;
        void show(){
            System.out.println("我是静态内部类IS");
        }
        static void s(){
            System.out.println("静态方法s()");
        }
    }

    class Inner {
        int n = 1;

        void show1() {
            System.out.println("m=" + m);
            t1();
        }

        void show2() {
            System.out.println("show2()");
        }
    }

    void t2() {
        Inner inner = new Inner();
        System.out.println("Inner.n" + inner.n);
        inner.show2();
    }
}

public class Example20 {
    public static void main(String[] args) {
        Outer outer = new Outer();
        Outer.Inner inner = outer.new Inner();
        inner.show1();
        outer.t2();
        Outer.IS is = new Outer.IS();
        System.out.println(is.n);
        Outer.IS.s();
    }
}
 +20 第四章Example22.java  0 -> 100644
package chapter04.Example22;

class Outer {
    static int m = 0;

    static class Inner {
        int n = 1;

        void show() {
            System.out.println("外部静态变量m = " + m);
        }
    }
}

public class Example22 {
    public static void main(String[] args) {
        Outer.Inner inner = new Outer.Inner();
        inner.show();
    }
}
 +18 第四章Example23.java  0 -> 100644
package chapter04.Example23;

interface Animal{
    void shout();
}
public class Example23 {
    public static void main(String[] args) {
        String name = "小花";
        animalShout(new Animal(){
            public void shout() {
                System.out.println(name+"喵喵······");
            }
        });
    }
    public static void animalShout(Animal an){
        an.shout();
    }
}
